﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using D2D2.Server.Networking;
using D2D2.SharedInterfaces.Networking;
using Lidgren.Network;

namespace D2D2.Server.Core
{
    public class SignalManager
    {
        private ServerManager _serverManager;

        public SignalManager(ServerManager serverManager)
        {
            _serverManager = serverManager;
            _serverManager.Battlefield = new BattlefieldServer(_serverManager);
        }

        public void HandleSignal(NetIncomingMessage message)
        {
            SignalMessage signal = new SignalMessage(message);
            switch (signal.SignalType)
            {
                case SignalType.GenerateBattlefield:
                    _serverManager.Battlefield.Generate(5, 5);
                    
                    /*Console.WriteLine(string.Format("Send: {0}", NetTime.Now));
                    TestMessage testMessage = new TestMessage();
                    _serverManager.SendMessage(testMessage);*/
                    break;
                default:
                    break;
            }
        }
    }
}
